<% var html={ %>
                <div class='row zq-row'>
                        <form name="sysUser_form" id="sysUser_form" class='form-inline'>
 <div class='form-group col-md-4 col-xs-6' style='margin-top: 10px;'>
 <label title='昵称'  >昵称：</label>
 <input  onkeyup='sysUserConsoleGrid.enterToQuery(event);' type='text' class='form-control' id='nickName' name='nickName' placeholder=''>
 </div>
                            <div class='form-group col-md-4 col-xs-6' style='margin-top: 10px;'>
                                <label title='状态' >状态：</label>
                                <select class="form-control" id="status" name="status">
                                    <option  value="">请选择...</option>
                                    <option  value="1">可用</option>
                                    <option  value="0">不可用</option>
                                </select>
                            </div>
                            <div align="center" class="form-group col-md-12 zq-table-query">
                                <button type='button' class='btn btn-default' id='sysUserQuerySearch'>查询</button>
                                <button type='button' class='btn btn-default' id='sysUserReset'>重置</button>
                            </div>
                        </form>

                </div>
                 <div id="sysUserToolbar" class="btn-group">
                              <button type="button" class="btn btn-default" onclick="consoleOpenWindow('sysUser','${ctxPath}/console/sys_user/add','新增')">
                                  <i class="glyphicon glyphicon-plus"></i>
                              </button>
                              <button type="button" class="btn btn-default" onclick='sysUserConsoleGrid.delete("suId","${ctxPath}/console/sys_user/delete");'>
                                  <i class="glyphicon glyphicon-trash"></i>
                              </button>
                 </div>
                     <div class='row zq-row' >
                                  <table id="sysUser" data-toggle="table"
                                         data-url="${ctxPath}/console/sys_user/json"
                                         data-pagination="true"
                                         data-query-params="sysUserLoadParam"
                                         method="post"
                                         data-side-pagination="server"
                                         data-show-refresh="true"
                                         data-show-toggle="true"
                                         data-pagination-loop="false"
                                         data-show-columns="true"
                                         data-toolbar="#sysUserToolbar">
                                      <thead>
                                      <tr>
                                           <th data-checkbox="true"></th>
                                            <th data-field='suId' data-visible='false'>ID</th>
  <th data-sortable='false' data-field='nickName'>昵称</th>
  <th data-sortable='false' data-field='userPic' data-formatter='sysUseruser_picFormatter'>头像</th>
  <th data-sortable='false' data-field='status' data-formatter='sysUserstatusFormatter'>状态</th>
  <th data-field='suId' data-formatter='sysUserTableOperate'>操作</th>
 
                                      </tr>
                                      </thead>
                                  </table>
                     </div>

<%};%>
<% var js= {%>
<script type="text/javascript">
    layui.use(['layer','laydate'], function(){

    });

    var sysUserConsoleGrid =new consoleGrid({table_id:"sysUser"});
     sysUserConsoleGrid.init();
     function sysUserTableOperate(value){
         return "<button type='button' class='btn btn-xs btn-default command-edit' onclick='consoleOpenWindow(\"sysUser\",\"${ctxPath}/console/sys_user/edit?id="+value+"\",\"编辑\")'><span class='glyphicon glyphicon-pencil'></span></button> <button type='button' class='btn btn-xs btn-default' onclick='accreditRole(\""+value+"\")'>授权</button>  <button type='button' class='btn btn-xs btn-default' onclick='authFarm(\""+value+"\")'>授权基地</button> ";
     }
    function authFarm(id){
        consoleOpenWindow("authuser","${ctxPath}/console/sys_user/farm/auth/page?userId="+id,"授权");
    }
    function sysUserLoadParam(params){
        params.query=sysUserQueryString();
        //防止304
        params.reqtime=new Date().getTime();
        return params;
    }
     function sysUserQueryString() {
         var objQuery = new Object();
            objQuery.userName=$('#userName').val()==''?null:$('#userName').val();
            objQuery.nickName=$('#nickName').val()==''?null:$('#nickName').val();
            objQuery.status=$('#status').val()==''?null:$('#status').val();
         var queryString = JSON.stringify(objQuery);
         return queryString;
     }
     function accreditRole(id){
         consoleOpenWindow("accreditRole","${ctxPath}/console/sys_role/user_accredit/"+id,"授权");
     }
     function sysUseruser_picFormatter(value)
     {
         return '<a href="'+value+'" target="_blank" > <img style="height:50px;" src="'+value+'" alt="缩略图"> </a>';
     }
     function sysUserstatusFormatter(value)
     {
         var showValue;
         switch(value+''){
             case '1':
                 showValue = '可用';
                 break;
             case '0':
                 showValue = '不可用';
                 break;
         }
         if(showValue.indexOf('不')!=-1||showValue.indexOf('否')!=-1||showValue.indexOf('禁')!=-1){
             return '<span class="label label-warning">'+showValue+'</span>';
         }else{
             return '<span class="label label-info">'+showValue+'</span>';
         }
     }
    
 </script>
<% }; %>
<% layout("/view/console/skins/skin_2/layout.html", {js:js,html:html}) {} %>
 